package com.tuanzi.loan.business.repository.settlement.impl;

import static com.tuanzi.loan.generated.jooq.loan.tables.CwOutTicketInfo.CW_OUT_TICKET_INFO;

import java.util.List;

import org.jooq.impl.TableImpl;

import com.tuanzi.loan.business.entity.settlement.CwOutTicketInfo;
import com.tuanzi.loan.business.repository.settlement.custom.CwOutTicketRepositoryCustom;
import com.tuanzi.loan.core.repository.JOOQBaseRepository;

public class CwOutTicketRepositoryImpl extends JOOQBaseRepository implements CwOutTicketRepositoryCustom {
    @Override
    public List<CwOutTicketInfo> getOutTicketInfoByCompanyId(Long companyId) {
        fields(CW_OUT_TICKET_INFO.fields());
        eq(CW_OUT_TICKET_INFO.COMPANY_ID,companyId);
        return search(record -> {
            CwOutTicketInfo cwOutTicketInfo = new CwOutTicketInfo();
            cwOutTicketInfo.setId(record.get(CW_OUT_TICKET_INFO.ID));
            cwOutTicketInfo.setCourierNumber(record.get(CW_OUT_TICKET_INFO.COURIER_NUMBER));
            cwOutTicketInfo.setSendManName(record.get(CW_OUT_TICKET_INFO.SEND_MAN_NAME));
            cwOutTicketInfo.setSendManMobile(record.get(CW_OUT_TICKET_INFO.SEND_MAN_MOBILE));
            cwOutTicketInfo.setSendDate(record.get(CW_OUT_TICKET_INFO.SEND_DATE));
            cwOutTicketInfo.setCompanyId(record.get(CW_OUT_TICKET_INFO.COMPANY_ID));
            cwOutTicketInfo.setReceiveDate(record.get(CW_OUT_TICKET_INFO.RECEIVE_DATE));
            cwOutTicketInfo.setOutTicketUrl(record.get(CW_OUT_TICKET_INFO.OUT_TICKET_URL));
            return cwOutTicketInfo;
        });
    }

    @Override
    protected TableImpl getTable() {
        return CW_OUT_TICKET_INFO;
    }
}
